package net.proef.sample.itcases;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

import java.util.Arrays;
import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

@RunWith(Parameterized.class)
public class FrontPageITCase {
    private final String PAGE_LOCATION = "http://localhost:8080/spring-sample/";
    private WebClient webClient;

    @Parameters
    public static List<Object[]> data() {
	return Arrays.asList(new Object[][] { { BrowserVersion.FIREFOX_3 }, { BrowserVersion.INTERNET_EXPLORER_7 } });
    }

    public FrontPageITCase(BrowserVersion browser) {
	webClient = new WebClient(browser);
    }

    @Test
    public void frontpageShouldOpen() throws Exception {
	final HtmlPage page = webClient.getPage(PAGE_LOCATION);

	assertThat(page, notNullValue());
	assertThat(page.getTitleText(), containsString("Sample"));
    }
}
